import pandas as pd
import pre_api
import json

def get_goods():
    data_all = []
    list_gg = ['ab9955','ab272488','ab286842','ab197979','ab133661','ab2601','ab102911']
    rj_api = pre_api.pre_api_get()
    responses = rj_api.ProductList(1, '{"brandIds" : [13]}')
    result = responses.content.decode('utf-8')
    data = json.loads(result)['data']
    data_all += data
    print(responses)
    # print(data_all)
    df = pd.DataFrame(data_all)
    # df.to_csv('get_json/abcam_.csv', index=False)
    list_code = list(df['code'])
    for code in list_gg:
        try:
            list_code.remove(code)
            print(code)
        except:
            pass
    # print(len(list_code))
    # responses = rj_api.offSale(list_code)
    # print(responses)
    responses = rj_api.deleteProduct(list_code)
    result = responses.content.decode('utf-8')
    print(responses)
    print(result)
    return df

if __name__ == '__main__':
    df = pd.read_excel('../final_up/MCE_rj.xlsx')
    print(list(df))
    print(df)
    # cate_df = pd.read_csv('merge_csv/abcam_rj_cate.csv',encoding='utf-8',usecols=['cate','cate3_id'])
    # df = df.merge(cate_df, how='inner', on='cate')
    # df.rename(columns={'cate3_id': 'cateid_rj'}, inplace=True)
    # print(df.iloc[:5, ])
    # df.to_csv('../final_up/abcam_small_rj_0.csv', encoding='utf-8', index=False)


